var select = fl.getDocumentDOM().selection;

if(select.length <= 0){
	alert( "Please make a selection on the stage" );
}else{
	select.reverse();
	var _frame = fl.getDocumentDOM().getTimeline().layers[0].frames[0];
	
	var assigns=[];
	var declarations=[];
	
	for(var i = 0, name,type; i < select.length; i++){
		name=select[i].name;
		if(select[i].textType=='dynamic' || select[i].textType=='input'){
			type='TextField';
		}else if(select[i].symbolType=='button'){
			type='Button';
		}else if(select[i].symbolType=='movie clip'){
			type='MovieClip';
		}else{
			continue;
		}

		assigns.push("			mc_"+name+"="+type+"(mc.getChildByName('"+name+"'));");
		declarations.push("		private var mc_"+name+" : "+type+";");
	}
	
	fl.outputPanel.clear();
	fl.trace(
		[
			assigns.join('\n')+'\n',
			declarations.join('\n')
		].join('\n')
	);

}